//全局过滤器

//过滤年月日  时分秒
export function formatYMDhms(data, separate = '/') {
    let time = new Date(data)
    let Y = time.getFullYear()
    let M = time.getMonth() + 1
    let D = time.getDate()

    let h = time.getHours()
    let m = time.getMinutes()
    let s = time.getSeconds()

    let YMD = [Y, M, D].map(v => String(v).padStart(2, '0')).join(separate)
    let hms = [h, m, s].map(v => String(v).padStart(2, '0')).join(':')

    return YMD + ' ' + hms
}

//过滤年月日
export function formatYMD(data) {
    let time = new Date(data)
    let Y = time.getFullYear()
    let M = time.getMonth() + 1
    let D = time.getDate()

    let YMD = [Y, M, D].map(v => String(v).padStart(2, '0')).join('/')

    return YMD
}

//过滤时分秒
export function formatHms(data) {
    let h = time.getHours()
    let m = time.getMinutes()
    let s = time.getSeconds()

    let hms = [h, m, s].map(v => String(v).padStart(2, '0')).join(':')
    return hms
}